package com.tapjoy;

import android.content.Context;
import android.content.Intent;

public class TapjoyDailyRewardAd
{
  private static TapjoyDailyRewardAdNotifier dailyRewardNotifier;
  public static String dailyRewardURLParams;
  private static String htmlData;
  private static TapjoyURLConnection tapjoyURLConnection = null;
  final String TAPJOY_DAILY_REWARD = "Daily Reward";
  private Context context;
  private String currencyID;

  public TapjoyDailyRewardAd(Context paramContext)
  {
    this.context = paramContext;
    tapjoyURLConnection = new TapjoyURLConnection();
  }

  public void getDailyRewardAd(TapjoyDailyRewardAdNotifier paramTapjoyDailyRewardAdNotifier)
  {
    TapjoyLog.i("Daily Reward", "Getting Daily Reward Ad");
    getDailyRewardAdWithCurrencyID(null, paramTapjoyDailyRewardAdNotifier);
  }

  public void getDailyRewardAdWithCurrencyID(String paramString, TapjoyDailyRewardAdNotifier paramTapjoyDailyRewardAdNotifier)
  {
    this.currencyID = paramString;
    TapjoyLog.i("Daily Reward", "Getting Daily Reward ad userID: " + TapjoyConnectCore.getUserID() + ", currencyID: " + this.currencyID);
    dailyRewardNotifier = paramTapjoyDailyRewardAdNotifier;
    dailyRewardURLParams = TapjoyConnectCore.getURLParams();
    dailyRewardURLParams = dailyRewardURLParams + "&publisher_user_id=" + TapjoyConnectCore.getUserID();
    if (this.currencyID != null)
      dailyRewardURLParams = dailyRewardURLParams + "&currency_id=" + this.currencyID;
    new Thread(new Runnable()
    {
      public void run()
      {
        TapjoyHttpURLResponse localTapjoyHttpURLResponse = TapjoyDailyRewardAd.tapjoyURLConnection.getResponseFromURL("https://ws.tapjoyads.com/reengagement_rewards?", TapjoyDailyRewardAd.dailyRewardURLParams);
        if (localTapjoyHttpURLResponse != null)
        {
          switch (localTapjoyHttpURLResponse.statusCode)
          {
          default:
            return;
          case 200:
            TapjoyDailyRewardAd.access$102(localTapjoyHttpURLResponse.response);
            TapjoyDailyRewardAd.dailyRewardNotifier.getDailyRewardAdResponse();
            return;
          case 204:
          }
          TapjoyDailyRewardAd.dailyRewardNotifier.getDailyRewardAdResponseFailed(1);
          return;
        }
        TapjoyDailyRewardAd.dailyRewardNotifier.getDailyRewardAdResponseFailed(2);
      }
    }).start();
  }

  public void showDailyRewardAd()
  {
    TapjoyLog.i("Daily Reward", "Displaying Daily Reward ad...");
    if ((htmlData != null) && (htmlData.length() != 0))
    {
      Intent localIntent = new Intent(this.context, TapjoyDailyRewardAdWebView.class);
      localIntent.setFlags(268435456);
      localIntent.putExtra("RE_ENGAGEMENT_HTML_DATA", htmlData);
      this.context.startActivity(localIntent);
    }
  }
}

/* Location:           E:\android\Toy Defense 2_dex2jar.jar
 * Qualified Name:     com.tapjoy.TapjoyDailyRewardAd
 * JD-Core Version:    0.6.2
 */